<extend name="base"/>

<block name="main">
    <div class="add-box">
        <div class="ab-list">

            <volist name="data" id="vo">
                <div class="abl-box">
                    <a class="ablb-nr" onclick="goTo('{$key}', '{$vo.id}')">
                        <label class="ablbn-mz">{$vo.username}</label>
                        <label class="ablbn-dh">{$vo.mobile}</label>
                        <label class="ablbn-mr">{$vo['is_default'] == 1 ? '默认地址' : ''}</label>
                        <div class="clear"></div>
                        <label class="ablbn-dz">{$vo.province}{$vo.city}{$vo.area}{$vo.address}</label>
                    </a>
                    <div class="ablb-sc">
                        <img src='__HELPER_IMG__/icon_det.png' onclick="deleteAddress('{$vo.id}')"></img>
                    </div>
                    <div class="clear"></div>
                </div>
            </volist>

        </div>

        <a class="ab-btn" href="{:U('my_add_xz')}">新增收货地址</a>
    </div>
</block>
<block name="js">
    <script>
        function goTo(key, id)
        {
            var is_back = "{:I('is_back')}" ? "{:I('is_back')}" : 0;

            if(is_back == 0){
                window.location.href = "/index.php?s=/Home/Helper/my_add_xz/id/" + id;
            }else{

            }

        }

        function deleteAddress(id)
        {
            var url = "Apis/delAddress";

            $.showLoading('删除中');

            post_ajax(url, {
                id: id
            }, function (res){
                layer.msg(res.msg);
                if(res.result == 1){
                    setTimeout(function (){
                        window.location.href = window.location.href;
                    },1000)
                }
            })
        }

    </script>
</block>
